<template>
  <a-config-provider :locale="zhCN">
    <router-view />
  </a-config-provider>
</template>

<script setup lang="ts">
import zhCN from "ant-design-vue/es/locale/zh_CN";
</script>

<style>
/* ==================== 全局样式 - 现代简约设计 ==================== */

/* CSS 变量 - 设计系统 */
:root {
  /* 主色调 - 优雅的蓝紫色 */
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-active: #4338ca;
  --primary-light: #eef2ff;

  /* 中性色 */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-color: #e5e7eb;
  --bg-gray: #f9fafb;
  --bg-white: #ffffff;

  /* 功能色 */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --info-color: #3b82f6;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* 过渡 */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--bg-gray);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  height: 100%;
}

/* 全局滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* 链接样式 */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* 按钮基础样式优化 */
.ant-btn {
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all var(--transition-base);
}

/* 主要按钮 */
.ant-btn-primary {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  box-shadow: var(--shadow-sm);
}

.ant-btn-primary:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
}

.ant-btn-primary:active {
  background: var(--primary-active) !important;
  border-color: var(--primary-active) !important;
  transform: translateY(0);
}

.ant-btn-primary:focus {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* 默认按钮 */
.ant-btn-default:hover {
  color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* 链接按钮 */
.ant-btn-link {
  color: var(--primary-color) !important;
}

.ant-btn-link:hover {
  color: var(--primary-hover) !important;
}

/* 卡片样式 */
.ant-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

/* 只有可点击的卡片才有 hover 效果 */
.ant-card.card-hoverable {
  transition: all var(--transition-base);
  cursor: pointer;
}

.ant-card.card-hoverable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ========== 输入框样式 ========== */
.ant-input,
.ant-input-affix-wrapper {
  border-radius: var(--radius-md) !important;
  transition: all var(--transition-base) !important;
}

/* Input 普通输入框 */
.ant-input:hover,
.ant-input-affix-wrapper:hover,
.ant-input-affix-wrapper:not(.ant-input-affix-wrapper-disabled):hover {
  border-color: var(--primary-color) !important;
}

.ant-input:focus,
.ant-input-focused,
.ant-input-affix-wrapper-focused {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* Input Password */
.ant-input-password:hover .ant-input {
  border-color: var(--primary-color) !important;
}

.ant-input-password-focused {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* ========== Select 选择框 ========== */
.ant-select:not(.ant-select-disabled):hover .ant-select-selector {
  border-color: var(--primary-color) !important;
}

.ant-select-focused:not(.ant-select-disabled) .ant-select-selector {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
  background-color: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

.ant-select-item-option-active:not(.ant-select-item-option-disabled) {
  background-color: var(--bg-gray) !important;
}

/* ========== InputNumber 数字输入框 ========== */
.ant-input-number {
  border-radius: var(--radius-md) !important;
}

.ant-input-number:hover {
  border-color: var(--primary-color) !important;
}

.ant-input-number:focus,
.ant-input-number-focused {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* 带单位的数字输入框 - 输入框部分不显示右边框圆角 */
.ant-input-number-group-wrapper .ant-input-number {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.ant-input-number-group-wrapper .ant-input-number:hover {
  border-right-color: #d9d9d9 !important;
}

.ant-input-number-group-wrapper .ant-input-number:focus,
.ant-input-number-group-wrapper .ant-input-number-focused {
  border-right-color: #d9d9d9 !important;
}

/* 单位后缀样式 */
.ant-input-number-group-addon {
  background-color: #fafafa;
  border-left: 0;
  border-color: #d9d9d9;
  color: var(--text-secondary);
  border-top-right-radius: var(--radius-md) !important;
  border-bottom-right-radius: var(--radius-md) !important;
}

/* hover 时，整个输入组的边框都变成主题色 */
.ant-input-number-group-wrapper:hover .ant-input-number,
.ant-input-number-group-wrapper:hover .ant-input-number-group-addon {
  border-color: var(--primary-color) !important;
}

/* focus 时保持右边框不变色 */
.ant-input-number-group-wrapper
  .ant-input-number:focus
  ~ .ant-input-number-group-addon,
.ant-input-number-group-wrapper
  .ant-input-number-focused
  ~ .ant-input-number-group-addon {
  border-color: var(--primary-color) !important;
}

/* ========== DatePicker 日期选择器 ========== */
.ant-picker:hover,
.ant-picker-focused {
  border-color: var(--primary-color) !important;
}

.ant-picker-focused {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* 单个日期选中 */
.ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {
  background: var(--primary-color) !important;
}

/* 范围选择器 - 开始日期 */
.ant-picker-cell-in-view.ant-picker-cell-range-start .ant-picker-cell-inner {
  background: var(--primary-color) !important;
}

/* 范围选择器 - 结束日期 */
.ant-picker-cell-in-view.ant-picker-cell-range-end .ant-picker-cell-inner {
  background: var(--primary-color) !important;
}

/* 范围选择器 - 范围内的日期 */
.ant-picker-cell-in-view.ant-picker-cell-in-range::before {
  background: var(--primary-light) !important;
}

/* 范围选择器 - 范围边缘 */
.ant-picker-cell-in-view.ant-picker-cell-range-start:not(
    .ant-picker-cell-range-start-single
  )::before,
.ant-picker-cell-in-view.ant-picker-cell-range-end:not(
    .ant-picker-cell-range-end-single
  )::before {
  background: var(--primary-light) !important;
}

/* 今天的日期边框 */
.ant-picker-cell-in-view.ant-picker-cell-today .ant-picker-cell-inner::before {
  border-color: var(--primary-color) !important;
}

/* DatePicker 确定按钮文字颜色 */
.ant-picker-ok button {
  color: #fff !important;
}

/* DatePicker 悬停日期 */
.ant-picker-cell-in-view:hover .ant-picker-cell-inner {
  background: var(--primary-light) !important;
}

/* RangePicker 悬停范围 */
.ant-picker-cell-in-view.ant-picker-cell-range-hover:not(
    .ant-picker-cell-in-range
  )::after,
.ant-picker-cell-in-view.ant-picker-cell-range-hover-start::after,
.ant-picker-cell-in-view.ant-picker-cell-range-hover-end::after {
  border-color: var(--primary-color) !important;
}

/* ========== TextArea 文本域 ========== */
.ant-input-textarea:hover .ant-input,
.ant-input-textarea-focused .ant-input {
  border-color: var(--primary-color) !important;
}

.ant-input-textarea-focused {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* ========== 复选框、单选框 ========== */
.ant-checkbox-checked .ant-checkbox-inner {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* 复选框选中后的 hover 效果边框 */
.ant-checkbox-checked::after {
  border-color: var(--primary-color) !important;
}

.ant-checkbox-wrapper:hover .ant-checkbox-inner,
.ant-checkbox:hover .ant-checkbox-inner {
  border-color: var(--primary-color) !important;
}

.ant-radio-wrapper:hover .ant-radio-inner,
.ant-radio:hover .ant-radio-inner {
  border-color: var(--primary-color) !important;
}

.ant-radio-checked .ant-radio-inner {
  border-color: var(--primary-color) !important;
  background-color: var(--primary-color) !important;
}

.ant-radio-inner::after {
  background-color: #fff !important;
}

.ant-radio-checked::after {
  border-color: var(--primary-color) !important;
}

/* Switch 开关 */
.ant-switch-checked {
  background: var(--primary-color) !important;
}

/* 分页器 */
.ant-pagination-item-active {
  border-color: var(--primary-color) !important;
  background: var(--primary-light) !important;
}

.ant-pagination-item-active a {
  color: var(--primary-color) !important;
}

.ant-pagination-item:hover {
  border-color: var(--primary-color) !important;
}

.ant-pagination-item:hover a {
  color: var(--primary-color) !important;
}

/* 表格样式 */
.ant-table {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ========== Menu 菜单 ========== */
/* 菜单项选中状态 */
.ant-menu-item-selected {
  background-color: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

.ant-menu-item-selected::after {
  border-right-color: var(--primary-color) !important;
}

/* 菜单项 hover */
.ant-menu-item:hover,
.ant-menu-submenu-title:hover {
  color: var(--primary-color) !important;
}

/* 子菜单选中状态 */
.ant-menu-submenu-selected .ant-menu-submenu-title {
  color: var(--primary-color) !important;
}

/* 子菜单展开时的图标 */
.ant-menu-submenu-open .ant-menu-submenu-arrow,
.ant-menu-submenu-selected .ant-menu-submenu-arrow {
  color: var(--primary-color) !important;
}

/* 内联菜单的选中项 */
.ant-menu-inline .ant-menu-item-selected {
  background-color: var(--primary-light) !important;
}

/* 子菜单项选中 */
.ant-menu-sub .ant-menu-item-selected {
  background-color: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

/* ========== Tabs 标签页 ========== */
.ant-tabs-tab:hover {
  color: var(--primary-color) !important;
}

.ant-tabs-tab-active {
  color: var(--primary-color) !important;
}

.ant-tabs-tab-active .ant-tabs-tab-btn {
  color: var(--primary-color) !important;
}

.ant-tabs-ink-bar {
  background: var(--primary-color) !important;
}

/* ========== Tag 标签 ========== */
.ant-tag {
  border-radius: var(--radius-sm);
}

/* ========== Tree 树形组件 ========== */
/* 复选框选中状态 */
.ant-tree .ant-tree-checkbox-checked .ant-tree-checkbox-inner {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* 复选框半选状态 */
.ant-tree .ant-tree-checkbox-indeterminate .ant-tree-checkbox-inner::after {
  background-color: var(--primary-color) !important;
}

/* 树节点悬停 */
.ant-tree .ant-tree-node-content-wrapper:hover {
  background-color: var(--primary-light) !important;
}

/* 树节点选中 */
.ant-tree .ant-tree-node-selected {
  background-color: var(--primary-light) !important;
}

/* 复选框交互 */
.ant-tree-checkbox-wrapper:hover .ant-tree-checkbox-inner,
.ant-tree-checkbox:hover .ant-tree-checkbox-inner,
.ant-tree-checkbox-input:focus + .ant-tree-checkbox-inner {
  border-color: var(--primary-color) !important;
}

/* 模态框样式 */
.ant-modal-content {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

/* 消息提示样式 */
.ant-message {
  top: 24px;
}

.ant-message-notice-content {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
</style>
